# ifndef __SaveState_H_
# define __SaveState_H_

class CSaveStateWrapperAction : public CEditAction {
  public:
	CSaveStateWrapperAction (CEditAction * _pAction, find_info_m_t & _Selection, bool _bWasModified) :
		m_pAction (_pAction),
		m_Selection (_Selection),
		m_bWasModified (_bWasModified)
	{}
	~CSaveStateWrapperAction () {delete m_pAction;}

	virtual void GetName (string_t & _str) const {m_pAction->GetName (_str);}
	virtual cu_t CanUndo () const {return m_pAction->CanUndo ();}
	virtual bool Do () {return m_pAction->Do ();}

	virtual void Undo () {
		m_pAction->Undo ();

		g_Selection = m_Selection;
		g_bModified = m_bWasModified;
	}
	virtual void Redo () {
		m_Selection = g_Selection;
		m_bWasModified = g_bModified;

		m_pAction->Redo ();
	}

  private:
	CEditAction * m_pAction;

	// The data used to restore state after undo/redo.
	find_info_m_t m_Selection;
	bool m_bWasModified;
};

# endif // __SaveState_H_